#include "particle.h"


CParticleSystem::CParticleSystem(int maxParticles, Vector3f origin)
{
  m_maxParticles = maxParticles;
  m_origin = origin;
  m_particleList = NULL;
}



int CParticleSystem::Emit(int numParticles)
{
  while (numParticles && (m_numParticles < m_maxParticles))
  {
    InitializeParticle(m_numParticles++);
    --numParticles;
  }
  return numParticles;
}


void CParticleSystem::InitializeSystem()
{
  if (m_particleList)
  {
    delete[] m_particleList;
    m_particleList = NULL;
  }

  m_particleList = new particle_t[m_maxParticles];

  m_numParticles = 0;
  m_accumulatedTime = 0.0f;
}


void CParticleSystem::KillSystem()
{
  if (m_particleList)
  {
    delete[] m_particleList;
    m_particleList = NULL;
  }

  m_numParticles = 0;
}

